export default {
	computed: {
		getUserInfo() { //获取用户全局信息
			return this.$store.getters['user/getUserInfo']
		},
	},
	data() {
		return {
			//设置全局默认的参数
			test_zhi_yin_shou_zhi: this.imgBaseURL + '/scl/test_result_bottom_shou_zhi_new.gif',
		}
	},
	methods: {
		backSclList() {
			uni.reLaunch({
				url: '/pages/sclList/sclList'
			})
		},
		// rpx转px
		rpxToPx(rpx) {
			const screenWidth = uni.getSystemInfoSync().screenWidth
			// console.log(screenWidth,'-======screenWidth')
			return (rpx * Number.parseInt(screenWidth)) / 750
		},
		useSubscription(fn) {
			const arr = this.$SUBSCRIBE_CODES
			const that = this
			// console.log('-------use')
			// console.log(fn,'----fn')
			uni.getSetting({ //getSetting获取用户的当前设置
				withSubscriptions: true,
				success: res => {
					console.log('res >>>>', res);
					if (res.subscriptionsSetting.mainSwitch &&
						res.subscriptionsSetting &&
						res.subscriptionsSetting[arr[0]] == 'accept' &&
						res.subscriptionsSetting[arr[1]] == 'accept' &&
						res.subscriptionsSetting[arr[2]] == 'accept') {
						fn&&fn()
					} else {
						uni.requestSubscribeMessage({
							tmplIds: arr,
							success: (res) => {
								console.log('成功');
								fn&&fn()
							},
							fail: (res) => {
								console.log('失败');
								fn&&fn()
							}
						})
					}
				}
			})


		}
	}
}